////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2017 Qualcomm Technologies, Inc.
// All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @file  camxchi.h
/// @brief Landing methods for CamX implementation of CHI
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

#ifndef CAMXCHI_H
#define CAMXCHI_H

#include "camxdefs.h"
#include "camxcsl.h"
#include "chi.h"
#include "chicommon.h"

CAMX_NAMESPACE_BEGIN

struct HALCallbacks;

enum ChiFenceState
{
    ChiFenceSuccess = 0, ///< Fence signaled with success
    ChiFenceFailed,      ///< Fence signaled with failure
    ChiFenceInvalid      ///< Fence invalid state
};

struct ChiFence
{
    CHIHANDLE           hChiFence;          ///< Handle to this Chi fence instance
    CHIFENCETYPE        type;               ///< Chi fence type
    INT                 aRefCount;          ///< Reference count
    CSLFence            hFence;             ///< CSL fence representing this Chi fence
    ChiFenceState       resultState;        ///< Fence signal result state
    union
    {
        UINT64          eglSync;        ///< EGL sync object (need to cast to EGLSyncKHR)
        INT             nativeFenceFD;  ///< Native fence file descriptor
    };
};

extern ChiContextOps g_jumpTableCHI;       ///< Global driver CHI entry point jump table

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// ChiOverrideBypass
///
/// @brief  Entry point used by the HAL layer to bypass the override, if necessary.  Not for use by the override.  Will be
///         deprecated.
///
/// @param  pBypassCallbacks  Function pointers for bypassing the override
///
/// @return None
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
VOID ChiOverrideBypass(
    HALCallbacks* pBypassCallbacks);

CAMX_NAMESPACE_END

#endif // CAMXCHI_H
